"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.compare = compare;
exports.contains = contains;
exports["default"] = void 0;
exports.deleteIndex = deleteIndex;
exports.deleteObject = deleteObject;
exports.equals = equals;
exports.indexOf = indexOf;

var _object = _interopRequireDefault(require("../object"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

/**
 * 是否包含
 * @param {[]} array
 * @param obj
 * @returns {boolean}
 */
function contains(array, obj) {
  for (var i = 0, length = array.length; i < length; i += 1) {
    if (array[i] === obj) {
      return true;
    }
  }

  return false;
}
/**
 * 索引
 * @param {[]} array
 * @param obj
 * @returns {number}
 */


function indexOf(array, obj) {
  for (var i = 0, length = array.length; i < length; i += 1) {
    if (array[i] === obj) {
      return i;
    }
  }

  return -1;
}
/**
 * 删除元素
 * @param {[]} array
 * @param obj
 */


function deleteObject(array, obj) {
  var index = indexOf(array, obj);

  if (index > -1) {
    array.splice(index, 1);
  }
}
/**
 * 删除元素
 * @param {[]} array
 * @param index
 */


function deleteIndex(array, index) {
  if (index > -1) {
    array.splice(index, 1);
  }
}
/**
 * 比较两个数组内元素是否相等
 * @param arrayOne
 * @param arrayTwo
 * @returns {boolean}
 */


function compare(arrayOne, arrayTwo) {
  return _object["default"].compare(arrayOne, arrayTwo);
}
/**
 * 比较两个数组内元素是否相等
 * @param arrayOne
 * @param arrayTwo
 * @returns {boolean}
 */


function equals(arrayOne, arrayTwo) {
  return compare(arrayOne, arrayTwo);
}

var _default = {
  contains: contains,
  indexOf: indexOf,
  deleteObject: deleteObject,
  deleteIndex: deleteIndex,
  compare: compare,
  equals: equals
};
exports["default"] = _default;